home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / emac16ds.zip / MINT.DEF < prev    next >
Text File  |  1991-06-13  |  2KB  |  116 lines

  1. timing    equ    0        ;conditional assembly flag for the
  2.                 ;  profiling code.
  3.  
  4. profile    macro    num
  5.   if 0
  6.     push    ax
  7.     push    dx
  8.     mov    dx,378h
  9.     mov    al,num
  10.     out    dx,al
  11.     pop    dx
  12.     pop    ax
  13.   endif
  14.     endm
  15.  
  16. mark_overhead    equ    3    ;one mark byte + one pointer (3 bytes total)
  17.  
  18. define_buffer    macro    x
  19. x&prev_buffer    dw    ?
  20. x&next_buffer    dw    ?
  21. x&toptop    dw    ?
  22. x&topbot    dw    ?
  23. x&bottop    dw    ?
  24. x&botbot    dw    ?
  25. x&new_size    dw    ?
  26.     endm
  27.  
  28. ;see if di is still below actptr.  If it isn't, we've run out of memory and
  29. ;  must abort.
  30. chk_room    macro    segreg
  31.     local    ok
  32.     cmp    di,data_bottop
  33.     jb    ok
  34.     push    ax
  35.     push    cx
  36.   ifnb <segreg>
  37.     mov    ax,segreg
  38.   else
  39.     mov    ax,ds
  40.   endif
  41.     mov    data_topbot,di
  42.     mov    cx,100            ;if we can't get 100 free bytes,
  43.     call    buffer_free        ;  we may as well not try for only 1.
  44.     pop    cx
  45.     pop    ax
  46.     jnc    ok
  47.     call    nomem
  48. ok:
  49.     endm
  50.  
  51. ;see if di+cx is still below data_bottop.  If it isn't, we've run out of memory
  52. ;  and must abort.
  53. chk_room_cnt    macro    segreg
  54.     local    not_ok, ok
  55.     push    di
  56.     add    di,cx
  57.     jc    not_ok
  58.     cmp    di,data_bottop
  59.     pop    di
  60.     jb    ok
  61.     push    di
  62. not_ok:
  63.     pop    di
  64.     push    ax
  65.   ifnb <segreg>
  66.     mov    ax,segreg
  67.   else
  68.     mov    ax,ds
  69.   endif
  70.     mov    data_topbot,di
  71.     call    buffer_free
  72.     pop    ax
  73.     jnc    ok
  74.     call    nomem
  75. ok:
  76.     endm
  77.  
  78. ;make di point to fbgn and push a copy of it.
  79. ;this macro is used by functions that return a value and don't need their
  80. ;  arguments.  More efficient than di_points_fend.
  81. di_points_fbgn    macro
  82.     mov    di,fbgn
  83.     dec    di
  84.     push    di
  85.     endm
  86.  
  87. ;make di point to fend and push a copy of it.
  88. ;this macro is used by functions that need their arguments.
  89. di_points_fend    macro
  90.     mov    di,fend
  91.     add    di,2
  92.     push    di
  93.     endm
  94.  
  95.  
  96. xchgdses    macro
  97.     push    ds
  98.     push    es
  99.     pop    ds
  100.     pop    es
  101.     endm
  102.  
  103.  
  104. dsdata    macro
  105.     push    ss
  106.     pop    ds
  107.     assume    ds:data
  108.     endm
  109.  
  110.  
  111. esdata    macro
  112.     push    ss
  113.     pop    es
  114.     assume    es:data
  115.     endm
  116.